package org.third.spring.event;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

class AbstractBeanUser {
    private String name;
    private String age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return "age=" + age + ", name=" + name;
    }

}

public class AbstractBeanTest {
    private static final Logger logger = LoggerFactory.getLogger(AbstractBeanTest.class);

    public static void main(String[] args) {
        ApplicationContext bf = new ClassPathXmlApplicationContext(AbstractBeanTest.class.getName().replaceAll("\\.", "/") + ".xml");
        AbstractBeanUser ldapUserAndRepFactory1 = (AbstractBeanUser) bf.getBean("ldapUserAndRepFactory1");
        AbstractBeanUser ldapUserAndRepFactory2 = (AbstractBeanUser) bf.getBean("ldapUserAndRepFactory2");
        logger.info(ldapUserAndRepFactory1.toString());
        logger.info(ldapUserAndRepFactory2.toString());

        logger.info("getBean with class:"+bf.getBean(AbstractBeanUser.class));
        /*
        AbstractBeanUser AbstractBeanUser1 = (AbstractBeanUser) bf.getBean("AbstractBeanUser");
        logger.info(AbstractBeanUser1.toString());*/

    }
}